package com.eascs.admin.o2o.applyAssessment.dao;

import java.util.Date;

import org.springframework.stereotype.Repository;

import com.eascs.admin.common.dao.BaseO2oDao;
import com.eascs.admin.o2o.applyAssessment.entity.ApplyAssessmentEntity;
import com.eascs.workflow.common.entity.wf.ProcessTaskMain;

@Repository
public class ApplyAssessmentDao extends BaseO2oDao {
	private static final String table_name = "o2o_apply_assessment";
	public static final int status_delete = 2;
	public static final int status_normal = 1;

	public boolean processApplyStart(String id) {
//		String sql = "UPDATE o2o_apply_assessment SET wf_status=? WHERE id=?";//2为审核中
		String sql = "UPDATE " + table_name + " SET wf_status=? WHERE id=?";
		int result = o2oJdbcSession.execute(sql, new Object[] { ProcessTaskMain.PROECESS_STATUS_HANDING, id });
		return result > 0 ? true : false;
	}

	public boolean delete(String id) {
		String sql = "UPDATE " + table_name + " SET STATUS=? WHERE id=?";
		int result = o2oJdbcSession.execute(sql, new Object[] { status_delete, id });
		return result > 0 ? true : false;
	}

	public boolean update(ApplyAssessmentEntity entity) {
		int result = o2oJdbcSession.updateById(entity);
		return result > 0 ? true : false;
	}

	public boolean updateApplyWfStatus(String id, int wfStatus) {
		String sql = "UPDATE " + table_name + " SET wf_status=? WHERE id=?";

		int result = o2oJdbcSession.execute(sql, new Object[] { wfStatus, id });
		return result > 0 ? true : false;
	}


}
